package ycl.important.common.base.entity;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.google.common.collect.Maps;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Map;

/**
 * 实体类基类
 *
 * @author: YCL
 * @date: 2021-06-04 23:59:23
 */
@Data
@Accessors(chain = true)
public class BaseEntity implements Serializable {

	private static final long serialVersionUID = -8280048470677145868L;

	@TableId(type = IdType.AUTO)
	private Long id;

	@TableField(exist = false)
	@ApiModelProperty(hidden = true)
	private Map<String, Object> params;

	public Map<String, Object> getParams() {
		if (CollUtil.isEmpty(params))
			params = Maps.newHashMap();
		return params;
	}
}
